package com.justnow.offer.q1;

public class JoinDemo01 {
    public static void main(String[] args) throws InterruptedException {

        for (int i = 0; i < 100; i++) {
            Thread thread1 = new Thread(() -> System.out.println("线程1正在执行。。。"));
            thread1.start();
            thread1.join();//thread1调用join方法的话，那么此时主线程停止执行，直到线程1执行完成之后，再开始主线程


            Thread thread2 = new Thread(() -> System.out.println("线程2正在执行。。。"));
            thread2.start();
            thread2.join();

            Thread thread3 = new Thread(() -> System.out.println("线程3正在执行。。。"));
            thread3.start();
        }

    }
}
